<?php 
$this->beginBlock('css');?>
  <link rel="stylesheet" type="text/css" href="<?= Yii::getAlias('@static')?>/pc/liketry/css/index.css">
<?php $this->endBlock();

use yii\helpers\Html;
use services\models\UpFileData;
use common\models\GoodsRedis;
use services\models\Goods;

$now = date('Y-m-d H:i:s');
?>
<!--首页头-->
<?= $this->render('@liketry/views/layouts/header_goods.php',['top_ad_show'=>true,'top_adv'=>true])?>
<?php if(!empty($banner_list))
       {
?>
<div class="index-banner flexslider" id="indexBanner">
	<ul class="slides">
    <?php 
		
			foreach($banner_list as $v)
			{
	  ?>
		<li style="background:url(<?= Yii::$app->params['goods_image_url'].$v['img']; ?>) 50% 0 no-repeat;"><a target="_blank" href="<?php echo $v['link']; ?>" ></a></li>
	<?php 
			}
	?>
	</ul>
</div>
<?php } ?>
<div class="main">
	<div class="main-inner">
    	<!--大试特试-->
        <div class="try-big">
        	<ul>
                 <?php if(isset($try_adv_list[1]) && !empty($try_adv_list[1])){?>   
            	<li>
                    <h2>有点易试</h2>
                    <div class="try-big-tips icon icon-try-tips">周周更新，试个不停</div>
                    <div class="try-big-image">
                        <?php foreach($try_adv_list[1] as $v){
                            if($now < $v['recommend_time'])  continue;
                            ?>
                        <a target="_blank" href="<?php echo $v['url']?>"><img data-original='<?= UpFileData::showImage($v['pic']);?>' alt="有点易试" title="有点易试"></a>
                        <?php if($now >= $v['recommend_time'])  break;       
                        }?>
                    </div>
                </li>
                 <?php } ?>
                <?php if(isset($try_adv_list[2]) && !empty($try_adv_list[2])){?>   
                <li>
                	<h2>先试后买</h2>
                    <div class="try-big-tips icon icon-try-tips">新潮好物，轻松感触</div>
                    <div class="try-big-image">
                        <?php foreach($try_adv_list[2] as $v){
                            if($now < $v['recommend_time'])  continue;
                            ?>
                        <a target="_blank" href="<?php echo $v['url']?>"><img data-original='<?= UpFileData::showImage($v['pic']);?>' alt="先试后买" title="先试后买"></a>
                        <?php if($now >= $v['recommend_time'])  break;       
                        }?>
                    </div>
                </li>
                 <?php } ?>
                <?php if(isset($try_adv_list[3]) && !empty($try_adv_list[3])){?>   
                <li>
                	<h2>有试晒单</h2>
                    <div class="try-big-tips icon icon-try-tips">名品口碑，看个过瘾</div>
                    <div class="try-big-image">
                        <?php foreach($try_adv_list[3] as $v){
                            if($now < $v['recommend_time'])  continue;
                            ?>
                        <a target="_blank" href="<?=\Yii::$app->urlManager->createUrl(['index/shaidan'])?>"><img data-original='<?= UpFileData::showImage($v['pic']);?>' alt="有试晒单" title="有试晒单"></a>
                        <?php if($now >= $v['recommend_time'])  break;       
                        }?>
                    </div>
                </li>
                 <?php } ?>
            </ul>
        </div>
        <!--每日一试-->
        <?php if(!empty($day_try_list)){ ?>
        <div class="try-day">
        	<h2 class="try-title"><span class="icon icon-title-bg">每日一<i>试</i></span></h2>
                <div class="try-day-image">
                    <?php 
                           foreach($day_try_list as $v){
                                if($now < $v['recommend_time'])  continue;    
                                //$product_info = GoodsRedis::getSkuRedis($v['product_id']);
                        ?>
                    <a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id']]);?>"><img data-original='<?= UpFileData::showImage($v['pic']);?>'></a>
                         <?php if($now >= $v['recommend_time'])  break;  
                    } ?>
                </div>
        </div>
        <?php } ?>
        <!--超值试用-->
        <div class="try-bargain">
        	<h2 class="try-title"><span class="icon icon-title-bg">超值<i>试</i>用</span></h2>
            <ul>
                <?php if(isset($super_try_list[1]) && !empty($super_try_list[1])){ 
                        foreach($super_try_list[1] as $v){
                            if($now < $v['recommend_time'])  continue;
                            $product_info = GoodsRedis::getSkuRedis($v['product_id']);
                            $goods_info = Goods::findByGoodsIdFromRedis($v['goods_id']);
                ?>   
            	<li>
                    <div class="try-bargain-image"><a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id']]);?>"><img data-original="<?php echo \Yii::$app->params['goods_image_url'] . str_replace('./upload/', 'upload/', $goods_info['pic']);?>"><span class="try-bargain-cover"></span></a></div>
					<div class="try-bargain-info">
                    <h3><a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id']]);?>"><?php echo $goods_info['goods_name']; ?></a></h3>
                    <?php if($product_info['type'] == 1)
                    {
                    ?>
                        <div class="try-bargain-coin"><span class="icon icon-try-coin"></span><i><?php echo $product_info['try_price']; ?></i><!--span>试豆</span--></div>
                    <?php
                    } elseif($product_info['type'] == 2)
                    {
                    ?>
                        <div class="try-bargain-price"><span class="icon icon-try-rmb"></span><!--span>￥</span--><i><?php echo $product_info['sale_price']; ?></i></div>
                    <?php
                    }else
                    {
                    ?>
                        <div class="try-bargain-price"><span class="icon icon-try-rmb"></span><!--span>￥</span--><i><?php echo $product_info['sale_price']; ?></i></div>
                        <div class="try-bargain-coin"><span class="icon icon-try-coin"></span><i><?php echo $product_info['try_price']; ?></i><!--span>试豆</span--></div>
                    <?php
                    }
                    ?>
					</div>
					<div class="try-bargain-btn"><a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id']]);?>" class="icon icon-try-btn">查看详情</a></div>
                </li>
                <?php if($now >= $v['recommend_time'])  break;       
                        } }?> 
                <?php if(isset($super_try_list[2]) && !empty($super_try_list[2])){ 
                        foreach($super_try_list[2] as $v){
                            if($now < $v['recommend_time'])  continue;
                            $product_info = GoodsRedis::getSkuRedis($v['product_id']);
                            $goods_info = Goods::findByGoodsIdFromRedis($v['goods_id']);
                ?>   
            	<li>
                    <div class="try-bargain-image"><a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id']]);?>"><img data-original="<?php echo \Yii::$app->params['goods_image_url'] . str_replace('./upload/', 'upload/', $goods_info['pic']);?>"><span class="try-bargain-cover"></span></a></div>
					<div class="try-bargain-info">
                    <h3><a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id']]);?>"><?php echo $goods_info['goods_name']; ?></a></h3>
                    <?php if($product_info['type'] == 1)
                    {
                    ?>
                        <div class="try-bargain-coin"><span class="icon icon-try-coin"></span><i><?php echo $product_info['try_price']; ?></i><!--span>试豆</span--></div>
                    <?php
                    } elseif($product_info['type'] == 2)
                    {
                    ?>
                        <div class="try-bargain-price"><span class="icon icon-try-rmb"></span><!--span>￥</span--><i><?php echo $product_info['sale_price']; ?></i></div>
                    <?php
                    }else
                    {
                    ?>
                        <div class="try-bargain-price"><span class="icon icon-try-rmb"></span><!--span>￥</span--><i><?php echo $product_info['sale_price']; ?></i></div>
                        <div class="try-bargain-coin"><span class="icon icon-try-coin"></span><i><?php echo $product_info['try_price']; ?></i><!--span>试豆</span--></div>
                    <?php
                    }
                    ?>
					</div>
                    <div class="try-bargain-btn"><a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id']]);?>" class="icon icon-try-btn">查看详情</a></div>
                </li>
                <?php if($now >= $v['recommend_time'])  break;       
                        } }?> 
                <?php if(isset($super_try_list[3]) && !empty($super_try_list[3])){ 
                        foreach($super_try_list[3] as $v){
                            if($now < $v['recommend_time'])  continue;
                            $product_info = GoodsRedis::getSkuRedis($v['product_id']);
                            $goods_info = Goods::findByGoodsIdFromRedis($v['goods_id']);
                ?>   
            	<li>
                    <div class="try-bargain-image"><a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id']]);?>"><img data-original="<?php echo \Yii::$app->params['goods_image_url'] . str_replace('./upload/', 'upload/', $goods_info['pic']);?>"><span class="try-bargain-cover"></span></a></div>
					<div class="try-bargain-info">
                    <h3><a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id']]);?>"><?php echo $goods_info['goods_name']; ?></a></h3>
                    <?php if($product_info['type'] == 1)
                    {
                    ?>
                        <div class="try-bargain-coin"><span class="icon icon-try-coin"></span><i><?php echo $product_info['try_price']; ?></i><!--span>试豆</span--></div>
                    <?php
                    } elseif($product_info['type'] == 2)
                    {
                    ?>
                        <div class="try-bargain-price"><span class="icon icon-try-rmb"></span><!--span>￥</span--><i><?php echo $product_info['sale_price']; ?></i></div>
                    <?php
                    }else
                    {
                    ?>
                        <div class="try-bargain-price"><span class="icon icon-try-rmb"></span><!--span>￥</span--><i><?php echo $product_info['sale_price']; ?></i></div>
                        <div class="try-bargain-coin"><span class="icon icon-try-coin"></span><i><?php echo $product_info['try_price']; ?></i><!--span>试豆</span--></div>
                    <?php
                    }
                    ?>
					</div>
                    <div class="try-bargain-btn"><a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id']]);?>" class="icon icon-try-btn">查看详情</a></div>
                </li>
                <?php if($now >= $v['recommend_time'])  break;       
                        } }?> 
            </ul>
        </div>
        <!--中部广告-->
        <?php
            $ad_1 = isset($liketry_ad_list[18]) ? $liketry_ad_list[18] : array('isshow'=>0,'arr'=>array());
            if($ad_1['isshow'] == 1 && !empty($ad_1['arr'])) {
        ?>
        <div class="goods-ad-center">
            <a target="_blank" href="<?php echo $ad_1['arr'][0]['url']; ?>"><img data-original="<?= Yii::$app->params['goods_image_url'].$ad_1['arr'][0]['image'];?>"></a>
        </div>
            <?php }?>
        
        <?php if($try_rec_list && !empty($try_rec_list)){ ?>
        <!--小试推荐-->
        <div class="try-recommend">
        	<h2 class="try-title"><span class="icon icon-title-bg">小<i>试</i>推荐</span></h2>
            <ul>
                <?php foreach($try_rec_list as $line_id => $val){
                        foreach ($val as $v){
                            if($now < $v['recommend_time'])  continue;  
                            $pic_array = explode(',', $v['pic']); 
                    ?>
                <li><a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id1']]);?>"><img data-original='<?= UpFileData::showImage($pic_array[0]) ?>' <?php echo $line_id == 1 ? 'class="pos-top"':'class="pos-bottom"'; ?>>
                    <span class="mask"></span>
                </a></li>
                <li><a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id2']]);?>"><img data-original='<?= UpFileData::showImage($pic_array[1]) ?>' <?php echo $line_id == 1 ? 'class="pos-top"':'class="pos-bottom"'; ?>>
                    <span class="mask"></span>
                </a></li>
                <li><a target="_blank" href="<?=Yii::$app->urlManager->createUrl(["goodsdetail/index",'product_id'=>$v['product_id3']]);?>"><img data-original='<?= UpFileData::showImage($pic_array[2]) ?>' <?php echo $line_id == 1 ? 'class="pos-top"':'class="pos-bottom"'; ?>>
                    <span class="mask"></span>
                </a></li>
                <?php if($now >= $v['recommend_time'])  break;  
                }} ?>
            </ul>
                <div class="clear"></div>
        </div>
        <?php } ?>
        <!--四个小广告-->
        <?php
            $ad_1 = isset($liketry_ad_list[19]) ? $liketry_ad_list[19] : array('isshow'=>0,'arr'=>array());
            if($ad_1['isshow'] == 1 && !empty($ad_1['arr'])) {
        ?>
        <div class="goods-ad-bottom">
        	<div class="goods-ad-bottom-in">
                    <a target="_blank" href="<?php echo $ad_1['arr'][0]['url']; ?>"><img data-original="<?= Yii::$app->params['goods_image_url'].$ad_1['arr'][0]['image'];?>"></a>
                    <a target="_blank" href="<?php echo $ad_1['arr'][1]['url']; ?>"><img data-original="<?= Yii::$app->params['goods_image_url'].$ad_1['arr'][1]['image'];?>"></a>
                    <a target="_blank" href="<?php echo $ad_1['arr'][2]['url']; ?>"><img data-original="<?= Yii::$app->params['goods_image_url'].$ad_1['arr'][2]['image'];?>"></a>
                    <a target="_blank" href="<?php echo $ad_1['arr'][3]['url']; ?>"><img data-original="<?= Yii::$app->params['goods_image_url'].$ad_1['arr'][3]['image'];?>"></a>
            </div>
        </div>
            <?php } ?>
    </div>
    <div class="service-bottom">
    	<ul>
            <li><span class="icon icon-service1s"></span><i>先试后买</i></li>
            <li><span class="icon icon-service2s"></span><i>正品保障</i></li>
            <li><span class="icon icon-service3s"></span><i>9.9包邮</i></li>
        </ul>
    </div>
</div>
<!--侧边栏-->
<?= $this->render('@liketry/views/layouts/sidebar.php')?>

<!--开机大图-->
<div class="first-wrap">
    <div>
        <img src="<?= Yii::getAlias('@static')?>/pc/liketry/images/open-first.jpg" />
        <a class="close close1"></a>
        <a class="close close2"></a>
    </div>
</div>

<?php $this->beginBlock('js');?>
<script src="<?= Yii::getAlias('@static')?>/pc/common/js/jquery-1.12.3.min.js"></script>
<script src="<?= Yii::getAlias('@static')?>/pc/common/js/lkt.pc.js"></script> 
<script src="<?= Yii::getAlias('@static')?>/pc/common/js/jquery.flexslider-min.js"></script>
<script src="<?= Yii::getAlias('@static')?>/pc/common/js/jquery.lazyload.min.js"></script>
<script src="<?= Yii::getAlias('@static')?>/pc/liketry/js/index.js"></script>

<?php $this->endBlock();?>